﻿using MediatR;
using W.Purchase.Domain;
using W.Purchase.Read.API.AppLication.Command.ReceivableCommand;
using W.Purchase.Repository.Interface;

namespace W.Purchase.Read.API.AppLication.CommandHandler.ReceivableCommandHandler
{
    public class ReceivableModelCommandHandler:IRequestHandler<ReceivableModelCommand, Receivable>
    {
        private readonly IReceivableRepository _ireceivableRepository;
        public ReceivableModelCommandHandler(IReceivableRepository ireceivableRepository)
        {
            _ireceivableRepository = ireceivableRepository;
        }

        public async Task<Receivable> Handle(ReceivableModelCommand request, CancellationToken cancellationToken)
        {
            var list = await _ireceivableRepository.GetModelAsync(request.ReceivableId);
            return list;
        }
    }
}
